//
//  BQCartoonView.m
//  Adorable_Things
//
//  Created by ybq on 16/1/11.
//  Copyright © 2016年 Banana Inc. All rights reserved.
//

#import "BQCartoonView.h"

@implementation BQCartoonView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(15, 15, 50, 10)];
        titleLabel.text = @"卡通形象";
        titleLabel.font = [UIFont systemFontOfSize:12];
        [self addSubview:titleLabel];
        
        _firstImageView = [[UIImageView alloc] initWithFrame:CGRectMake(15, titleLabel.bottom + 15, (kWidth - 40) / 2, (kWidth - 40) / 2)];
        _firstImageView.layer.cornerRadius = 5;
        _firstImageView.image = [UIImage imageNamed:@"placeHolder-2"];
        [self addSubview:_firstImageView];
        
        _secondButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
        _secondButton.frame = CGRectMake(_firstImageView.right + 10, _firstImageView.frame.origin.y, ((kWidth - 40) / 2 - 10) / 2, ((kWidth - 40) / 2 - 10) / 2);
        [_secondButton setImage:[UIImage imageNamed:@"placeHolder-2"] forState:(UIControlStateNormal)];
        _secondButton.layer.cornerRadius = 5;
        _secondButton.layer.masksToBounds = YES;
        [self addSubview:_secondButton];
        
        _thirdButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
        _thirdButton.frame = CGRectMake(_secondButton.right + 10, _secondButton.frame.origin.y, ((kWidth - 40) / 2 - 10) / 2, ((kWidth - 40) / 2 - 10) / 2);
        [_thirdButton setImage:[UIImage imageNamed:@"placeHolder-2"] forState:(UIControlStateNormal)];
        _thirdButton.layer.cornerRadius = 5;
        _thirdButton.layer.masksToBounds = YES;
        [self addSubview:_thirdButton];
        
        _fourthButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
        _fourthButton.frame = CGRectMake(_firstImageView.right + 10, _secondButton.bottom + 10, ((kWidth - 40) / 2 - 10) / 2, ((kWidth - 40) / 2 - 10) / 2);
        [_fourthButton setImage:[UIImage imageNamed:@"placeHolder-2"] forState:(UIControlStateNormal)];
        _fourthButton.layer.cornerRadius = 5;
        _fourthButton.layer.masksToBounds = YES;
        [self addSubview:_fourthButton];
        
        _fifthButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
        _fifthButton.frame = CGRectMake(_fourthButton.right + 10, _fourthButton.frame.origin.y, ((kWidth - 40) / 2 - 10) / 2, ((kWidth - 40) / 2 - 10) / 2);
        [_fifthButton setImage:[UIImage imageNamed:@"placeHolder-2"] forState:(UIControlStateNormal)];
        _fifthButton.layer.cornerRadius = 5;
        _fifthButton.layer.masksToBounds = YES;
        [self addSubview:_fifthButton];
        
    }
    return self;
}

@end
